import { createRouter, createWebHashHistory } from 'vue-router'
import Home from '../views/Home.vue'

import CategoryEdit from '../components/CategoryEdit.vue'
import CategoryList from '../components/CategoryList.vue'

import CourseEdit from '../components/CourseEdit.vue'
import CourseList from '../components/CourseList.vue'

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    children: [
      { path: '/category/edit/:id', component: CategoryEdit, props: true },
      { path: '/category/create', component: CategoryEdit },
      { path: '/category/list', component: CategoryList },

      { path: '/course/edit/:id', component: CourseEdit, props: true },
      { path: '/course/create', component: CourseEdit },
      { path: '/course/list', component: CourseList }
    ]
  }
]

const router = createRouter({
  // history: createWebHistory(process.env.BASE_URL),
  history: createWebHashHistory(process.env.BASE_URL),
  routes
})

export default router
